package sequential;

import com.fluagen.example.vertx.util.Runner;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;

public class MainVerticle extends AbstractVerticle {
	
	Logger log = LoggerFactory.getLogger(MainVerticle.class);
	
	public void start(Future<Void> startFuture) throws Exception {
		
		Future<Void> fut = Future.future();
		
		fut.compose(v -> {
			Future<Void> f = Future.future();
			log.info("起床");
			f.complete();
			return f;
		}).compose(v -> {
			Future<Void> f = Future.future();
			log.info("乘地铁");
			f.complete();
			return f;
		}).compose(v -> {
			Future<Void> f = Future.future();
			log.info("到公司打卡");
			f.complete();
			return f;
		}).compose(v -> {
			Future<Void> f = Future.future();
			log.info("下班打卡");
			f.complete();
			return f;
		}).compose(v -> {
			Future<Void> f = Future.future();
			log.info("乘地铁回家");
			f.complete();
			return f;
		}).compose(v -> {
			Future<Void> f = Future.future();
			log.info("睡觉");
			f.complete();
			return f;
		});
		
		fut.complete();
	}
	
	public static void main(String[] args){
		Runner.deploy(MainVerticle.class);
	}
}
